<%@ page language="java" pageEncoding="ISO-8859-1" import="java.util.*"%>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
    
    <title>policedistiiccode.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
   <script>
      function getcode(v,f)
      { 
         
         var x;
      try
      {
          x=new XMLHttpRequest();
      }
     catch(e)
      {
          try
          {
             x=new ActiveXObject("Msxml2.XMLHTTP");
          }
          catch(e)
          {
                try
                 {
                    x=new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch(e)
                 {
                   alert("Browser not supported");
                }
           }
     }
    x.open("get","/police/apsa.do?apsp=getCodeIIC&DNN="+v,true);
    x.send(null);
    x.onreadystatechange=f2;
    function f2()
    {
   
    if(x.readyState==4)
    {
    y=x.responseText;
    f.sc.value=y
    }
    }
    						
    }
         
      
      
      
   </script>
  </head>
  
  <body bgcolor="pink"><br>

   <html:form action="pdiic">
   <div align="center">
   <% 
   ArrayList dn=(ArrayList)request.getAttribute("DN");
   ArrayList pd=(ArrayList)request.getAttribute("PPD");
   Object ob1=request.getAttribute("kk");
   
  %>
  
     <%if(ob1!=null)
	{ 
	
	
	System.out.println(pd);
	
	%>
      <table width="50%">
     
							
         <tr><td width="">Police Station name<br></td>
							<td><html:select property="dest" onchange="getcode(this.value,this.form)" >
							<html:option value="select">Select one policestation</html:option>
							
							 <%
							 for(int i=0;i<dn.size();i++)
		    	             {
		    	             
		    	             
		    	             %>
      
							
							<html:option value="<%=pd.get(i).toString()%>"> <%=dn.get(i).toString() %></html:option>
							
							<%
							
							} 
							%>
							</html:select>
							<td><label id="pdes"></label></td>
		
							</tr>
      <tr><td> IIC CODE</td><td><html:text property="sc"></html:text> <br></td></tr>
      <tr><td>IIC NAME</td><td><html:text property="sn"></html:text> <br></td></tr>
      <tr><td><html:submit property="pdiicp" value="SETPDIICCODE" ></html:submit> <br></td></tr>
      
    
      </table>
       <%  
       }%>
       
        <table>
       <%Object ob=request.getAttribute("INS") ;
       if 
       (ob!=null)
       {
       %>
      <tr><td><%=ob.toString() %></td></tr>
       <%} %>
       
       </table>
    </div>
   
   
   </html:form>
  </body>
</html:html>
